package wicresoft.controller.common;

import util.cryptogram.MD5Util;
import util.io.ResourceUtil;

import java.io.InputStream;
import java.util.Map;

/**
 * Created by Administrator on 2018/2/7.
 */
public class Properties {
//    public static String baseUrl = "http://127.0.0.1:8082/api/httpApi/";
//public static String baseUrl = "http://192.168.196.115/apitest/httpApi/";

    public static String baseUrl;
    public static  String uid;
    public static  String key;
    public static  String addBusinessInfo ;
    public static  String gongXuAutomaticExtractionExpert ;
    public static  String jianYanAutomaticExtractionExpert;
    public static  String gongXuManuallyExtractionExpert;
    public static  String jianYanManuallyExtractionExpert;
    public static  String addBusinessExperts;
    public static  String addBusinessResult;
    public static  String getExpertDetailInfo;
    public static  String verifyExpertAccount;
    public static  String getBusinessInfo;

    public static   String  GX_ITEM_ID;
    public static   String  GX_ITEM_NUM;
    public static   String  JY_ITEM_ID;
    public static   String  JY_ITEM_NUM;



    static {
        try {
            java.util.Properties properties = new java.util.Properties();
            InputStream is = ResourceUtil.getInputStreamForPath("classpath:config/properties/system.properties");
            properties.load(is);

            baseUrl = properties.getProperty("baseUrl");
            uid = properties.getProperty("uid");
            key = properties.getProperty("key");
            addBusinessInfo = properties.getProperty("addBusinessInfo");
            gongXuAutomaticExtractionExpert = properties.getProperty("gongXuAutomaticExtractionExpert");
            jianYanAutomaticExtractionExpert = properties.getProperty("jianYanAutomaticExtractionExpert");
            gongXuManuallyExtractionExpert = properties.getProperty("gongXuManuallyExtractionExpert");
            jianYanManuallyExtractionExpert =properties.getProperty("jianYanManuallyExtractionExpert");
            addBusinessExperts = properties.getProperty("addBusinessExperts");
            addBusinessResult = properties.getProperty("addBusinessResult");
            getExpertDetailInfo = properties.getProperty("getExpertDetailInfo");
            verifyExpertAccount = properties.getProperty("verifyExpertAccount");
            getBusinessInfo = properties.getProperty("getBusinessInfo");

            GX_ITEM_ID = properties.getProperty("GX_ITEM_ID");
            GX_ITEM_NUM = properties.getProperty("GX_ITEM_NUM");
            JY_ITEM_ID = properties.getProperty("JY_ITEM_ID");
            JY_ITEM_NUM = properties.getProperty("JY_ITEM_NUM");


        } catch (Exception e) {
            throw new RuntimeException("读取配置文件出现异常 classpath:config/properties/system.properties");
        }
    }


    public static void main(String args[]) {
        
        System.out.println("dd");
        
    }



    public static String sendData(String interfaceName, Map<String,Object> dataMap, String uid, String key) throws Exception {

        dataMap.put("uid",uid);
        dataMap.put("timeStamp",new Long(System.currentTimeMillis()).toString());
        dataMap.put("sign", MD5Util.md5Hex(dataMap.get("timeStamp") + key));

        return HttpUtils.post(baseUrl + interfaceName, dataMap);
    }


}
